//
//  RadioCollectionHeaderView.swift
//  readtool
//
//  Created by Wan Jiading on 2017/6/8.
//  Copyright © 2017年 DAD. All rights reserved.
//

import UIKit

class RadioCollectionHeaderView: UIView {

	var titleLabel: UILabel!
	
	convenience init(title: String) {
		self.init()
		
		titleLabel = UILabel()
		titleLabel.textColor = UIColor.rgb("38831d")
		titleLabel.font = UIFont.systemFont(ofSize: 16)
		titleLabel.numberOfLines = 0
		titleLabel.textAlignment = .center
		titleLabel.text = title
		self.addSubview(titleLabel)
		
		titleLabel.sizeToFit()
		
		titleLabel.snp.makeConstraints { [weak self] (make) in
			make.top.equalTo((self?.snp.top)!).offset(30)
			make.bottom.equalTo((self?.snp.bottom)!)
			make.left.equalTo((self?.snp.left)!).offset(15)
			make.right.equalTo((self?.snp.right)!).offset(-15)
		}
	}
	
	func getHeight() -> CGFloat {
		
		layoutIfNeeded()
		
		return self.height
	}
}
